<?php
/**
 * User: liubao
 * Date: 19-5-3
 * Time: 下午8:31
 */

namespace App\Controller;


use App\Service\CommentsService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class CommentsController extends AbstractController
{
    /**
     * @Route("article/all",methods={"GET"})
     */
    public function getAllArticle(Request $request): Request
    {
        $res = CommentsService::getCommentAll();
        if (!empty($res)) {
            $res = array('code' => 20000, 'data' => $res, 'msg' => '成功', 'success' => true);
            echo json_encode($res, JSON_UNESCAPED_UNICODE);
            die;
        } else {
            $res = array('code' => 500, 'data' => $res, 'msg' => '未知错误', 'success' => false);
            echo json_encode($res, JSON_UNESCAPED_UNICODE);
            die;
        }
    }

}